# from file_config import user_nums
# from tools.aes_enc import count_encrypted_data,read_encrypted_data,decrypt_message_dict
# from file_tools import save_decrypted_data


# if __name__ == '__main__':

#     # messages = [
#     #     {"type": "aes", "name": "韩泽斌", "url": "http://example.com", "username": "user1", "password": "password1"},
#     #     {"type": "rsa", "name": "李哲辉", "url": "http://example.com", "username": "user1", "password": "password1"},
#     #     {"type": "aes", "name": "王刀郎", "url": "http://example.com", "username": "user1", "password": "password1"}
#     # ]
#     # # 加密并保存到文件
#     # for message in messages:
#     #     importlib.reload(file_config)
#     #     pri_key_or_psd = file_config.pri_key_or_psd
#     #     encrypted_message, encrypt_type, pri_key_or_psd = aes_enc.encrypt_message_dict(message, pri_key_or_psd,user_nums=1)

#     # messages2 = [
#     #     {"type": "aes", "name": "韩泽斌2", "url": "http://example.com", "username": "user1", "password": "password1"},
#     #     {"type": "rsa", "name": "李哲辉2", "url": "http://example.com", "username": "user1", "password": "password1"},
#     #     {"type": "aes", "name": "王刀郎2", "url": "http://example.com", "username": "user1", "password": "password1"}
#     # ]
#     # # 加密并保存到文件
#     # for message in messages2:
#     #     importlib.reload(file_config)
#     #     pri_key_or_psd = file_config.pri_key_or_psd
#     #     encrypted_message, encrypt_type, pri_key_or_psd = aes_enc.encrypt_message_dict(message, pri_key_or_psd,user_nums=2)

#     # for i in range(user_nums):
#     #     file_num = i+1
#     #     # 读取文件中的加密数据数量
#     #     num_entries = count_encrypted_data(f'file/user{file_num}/code{file_num}.txt')
#     #     print("Number of encrypted data entries:", num_entries)

#     #     for i in range(num_entries):
#     #         # 读取加密数据从文件
#     #         salt_ciphertext, encrypt_type, pri_key_or_psd = read_encrypted_data(f'file/user{file_num}/code{file_num}.txt', i)

#     #         # 解密数据
#     #         decrypted_message = decrypt_message_dict(salt_ciphertext, pri_key_or_psd, encrypt_type)
#     #         print(f"Decrypted message {i + 1}:", decrypted_message)


#     # save_decrypted_data(1)


#     pass

from PyQt5 import QtCore, QtGui, QtWidgets
from tools.generate_psd import generate_strong_password
import json
import importlib
global last_user
import file_config
from file_config import last_user,psd_key
from file_tools import modify_last_user
from tools.des_enc import des3_encrypt,des3_decrypt
from ui_test import Ui_LoginWindow
if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_LoginWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())